package com.dg.gaming.api.common.msg;

import com.dg.gaming.api.common.*;
import nanoxml.*;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2009</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class MsgTableConnect implements ITransmittable {
    private Table table;
    private String userName;
    public MsgTableConnect(Table table, String userName) {
        this.table = table;
        this.userName = userName;
    }

    public MsgTableConnect(XMLElement message) throws TransmissionException {
        this.table = new Table(message);
        this.userName = message.getStringAttribute(User.XML_ATT_USERNAME);
    }

    public XMLElement flatten() {
        XMLElement message = table.flatten();
        message.setAttribute(User.XML_ATT_USERNAME, userName);
        return message;
    }

    public Table getTable() {
        return table;
    }

    public String getUserName() {
        return userName;
    }
}
